package com.sunny;

import javax.imageio.stream.FileImageInputStream;
import java.io.*;
import java.nio.ByteBuffer;

public class FileRead {

    public static void main(String[] args) {

        String path = "aaa";
        File file = new File(path);
        try (FileInputStream fin = new FileInputStream(file)){
            InputStreamReader isr = new InputStreamReader(fin, "UTF-8");
//            int c;
//            while ((c=isr.read()) != -1){
//                System.out.print((char)c);
//            }
//            char[] str = new char[100];
//            while ((isr.read(str))!=-1){
//                System.out.print(str);
//            }
            byte[] bytes = new byte[100];
            while ((fin.read(bytes)) != -1){
                System.out.write(bytes);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
